<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset={$charset}" />
<title>{$site_name}{lang button_regist} - Powered by Cyask</title>
<link href="{$web_path}{$styledir}/1000ask.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="{$web_path}include/functions.js"></script>
<script type="text/javascript" src="{$web_path}include/xmlhttp.js"></script>
<script type="text/javascript">
function parse_message(data)
{
	var did=document.getElementById("usernametip");
	if(data)
	{
		if(data=='no')
		did.innerHTML='<font size="2" color="red">{lang warning_username_used}</font>';
		else if(data=='yes')
		did.innerHTML='<font size="2" color="red">{lang warning_username_good}</font>';
		else if(data=='error')
		did.innerHTML='<font size="2" color="red">{lang warning_username_error}</font>';
		else
		did.innerHTML='<font size="2" color="red"></font>';
	}
	else
	{
		did.innerHTML='<font size="2" color="red">{lang warning_data_checking}</font>';
	}
}
function parse_emailmessage(data)
{
	var did=document.getElementById("emailtip");
	if(data)
	{
		 
		if(data=='1')
			did.innerHTML='<font size="2" color="red">{lang warning_email_good}</font>';
		else if(data=='-4')
			did.innerHTML='<font size="2" color="red">{lang warning_email_used}</font>';
		else if(data=='-5')
			did.innerHTML='<font size="2" color="red">{lang warning_email_forbid}</font>';
		else if(data=='-6')
			did.innerHTML='<font size="2" color="red">{lang regist_email_error6}</font>';
		else
			did.innerHTML='<font size="2" color="red">{lang warning_email_error}'+data+'</font>';
	}
	else
	{
		did.innerHTML='<font size="2" color="red">{lang warning_data_checking}</font>';
	}
}
function _esc(a)
{
	return window.encodeURIComponent?encodeURIComponent(a):escape(a)
}
function check_username(f)
{
	var did=document.getElementById("usernametip");
	var url='usercheck.php?username='+_esc(f.username.value);
	if(f.username.value=="")
	{
		did.innerHTML='<font size="2" color="red">{lang warning_username_null}</font>';
	}
	else if(f.username.value.length<2)
	{
		did.innerHTML='<font size="2" color="red">{lang warning_username_short}</font>';
	}
	else
	{
		XMLHttp.getR(url,parse_message,'text');
	}
}
function check_regemail(f)
{
	var did=document.getElementById("emailtip");
	var url='usercheck.php?email='+f.email.value;
	if(f.email.value=="")
	{
		did.innerHTML='<font size="2" color="red">{lang warning_email_null}</font>';
	}
	else if(f.email.value=="" || f.email.value.indexOf("@")==-1 || f.email.value.indexOf(".")==-1)
	{
		did.innerHTML='<font size="2" color="red">{lang warning_email_error}</font>';
	}
	else
	{
		XMLHttp.getR(url,parse_emailmessage,'text');
	}
}

function check_password(f)
{
	if(f.password.value == '' || f.password.value == null)
	{
		document.getElementById("passwordtip").innerHTML="<font size=\"2\" color=\"red\">{lang warning_password_null}</font>";
		//f.password.focus();
	}
	else
	{
		document.getElementById("passwordtip").innerHTML="";
	}
}
function check_confirmpw(f)
{
	if(f.password.value != f.confirmpw.value)
	{
		document.getElementById("confirmpwtip").innerHTML="<font size=\"2\" color=\"red\">{lang warning_password_error}</font>";
		//f.confirmpw.focus();
	}
	else
	{
		document.getElementById("confirmpwtip").innerHTML="";
	}
}
function check_registform(f)
{
	var username=str_trim(f.username.value);
	f.username.value=username;
	if(f.username.value == '' || f.username.value == null)
	{
		document.getElementById("usernametip").innerHTML='<font size="2" color="red">{lang warning_username_null}</font>';
		f.username.focus();
		return false;
	}
	if(f.password.value == '' || f.password.value == null)
	{
		document.getElementById("passwordtip").innerHTML="<font size=\"2\" color=\"red\">{lang warning_password_null}</font>";
		f.password.focus();
		return false;
   	}
	if(f.password.value.length<3)
	{
		document.getElementById("passwordtip").innerHTML="<font size=\"2\" color=\"red\">{lang warning_password_short}</font>";
		f.password.focus();
		return false;
	}
	if(f.password.value != f.confirmpw.value)
	{
		document.getElementById("confirmpwtip").innerHTML="<font size=\"2\" color=\"red\">{lang warning_password_error}</font>";
		f.password.value = '';
		f.confirmpw.value = '';
		f.password.focus();
		return false;
	}
	if(f.email.value=="" || f.email.value.indexOf("@")==-1 || f.email.value.indexOf(".")==-1)
	{
		document.getElementById("emailtip").innerHTML="<font color=\"red\">{lang warning_email_error}</font>";
		return false;
	} 
}
</script>
</head>
<body>
<div id="main" style="height:100%">
<div align="left">
<table cellspacing="3" cellpadding="3" width="100%" border="0">
<tr><td valign="top" width="160">&nbsp;&nbsp;<a href="{$web_path}"><img src="{$styledir}/1000ask.gif" border="0" /></a></td>
<td class="f14" nowrap="nowrap">&nbsp;&nbsp;<a href="{$web_path}"><b>{lang button_back_index}</b></a></td></tr>
</table>
</div>
<div id="c90">
<div class="t3 bcb"><div class="t3t bgb">{lang button_regist}</div></div>
<div class="b3 bcb mb12">
<div class="w100">
<form name="registform" action="{$web_path}register.php" method="post" onSubmit="return check_registform(this);">
<table cellspacing="0" cellpadding="0" width="100%" border="0">
<tr valign="middle"><td class="f14" height="50" align="center" colspan="3">{lang warning_regist_note}</td></tr>
<tr valign="middle" bgcolor="#efefef">
<td class="f14" width="35%" height="50" align="right" nowrap="nowrap">{lang menu_username} :</td>
<td width="20%"><input name="username" size="20" maxlength="18" onBlur="check_username(registform);" /></td>
<td width="45%"><span id="usernametip">{lang set_username_explain}</span></td>
</tr>
<tr valign="middle">
<td class="f14" width="35%" align="right" height="45" nowrap="nowrap">{lang menu_password} :</td>
<td width="20%"><input type="password" name="password" size="20" maxlength="16" onBlur="check_password(registform);"/></td>
<td width="45%"><span id="passwordtip">{lang set_pw_explain}</span></td>
</tr>
<tr valign="middle" bgcolor="#efefef">
<td class="f14" width="35%" align="right" height="45" nowrap="nowrap">{lang menu_confirmpw} :</td>
<td width="20%"><input type="password" name="confirmpw" size="20" maxlength="16" onBlur="check_confirmpw(registform);" /></td>
<td width="45%"><span id="confirmpwtip">{lang set_repw_explain}</span>
</td>
</tr>
<tr valign="middle" bgcolor="#efefef">
<td class="f14" width="35%" align="right" height="45" nowrap="nowrap">{lang menu_email} :</td>
<td width="20%"><input type="text" name="email" size="20" maxlength="40" onBlur="check_regemail(registform);" /></td>
<td width="45%"><span id="emailtip"></span>
</td>
</tr>
<tr valign="middle">
<td width="35%">&nbsp;</td>
<td width="65%" height="50" colspan="2" align="left">
<input type="submit" name="registsubmit" value="{lang button_submit}" class="bnsrh" />
<input type="hidden" name="command" value="registed" />
<input type="hidden" name="formhash" value="{echo form_hash()}" />
<input type="hidden" name="url" value="{$url}" />
</td></tr>
</form>
</table>
</div>
</div>
<br />
{template footer}